Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Jul 22, 2025

Part 1 of WOOMOB-913

Just one review is required.

Description

This PR is part 1 of updating plugin matching to use the file name in plugin path instead of matching by plugin name. This change addresses edge cases where plugin paths can be altered by certain hosts or other plugins.

This PR removes a subset of plugin matching by name use cases across the app and replaces them with a more robust plugin matching approach using the PluginsService.loadPluginInStorage method with a plugin enum. The changes include:

Key changes:

  • Removed storage method loadSystemPlugin(siteID:name:) and related use cases in order details
  • Added Plugin enum to centralize plugin matching logic and keep implementation details internal within Yosemite
  • Enhanced PluginsService with loadPluginInStorage method that accepts a plugin enum for synchronous plugin loading
  • Updated ProductListViewModel to remove plugin matching by name use case, with test cases for the changes
  • Refactored OrderDetailsViewModel to use the new plugin enum approach instead of name-based matching
  • Removed SystemStatusAction.fetchSystemPluginListWithNameList usage across the codebase
  • Updated POS system status service to use the new plugin loading approach in PluginsService

Implementation details

The implementation moves away from fragile name-based plugin matching towards a more durable approach that will support filename-based matching in subsequent PRs. The Plugin enum provides a centralized way to identify plugins while keeping the matching implementation details internal to the service layer.

Steps to reproduce

Since this is a refactoring change that maintains existing functionality:

  1. Navigate to order details for orders --> order details UI should work as before
  2. In the Products tab, the scan button in the left of the navigation bar should only be shown if Woo Square plugin is not installed and active
  3. Access POS functionality for eligible stores

Testing information

I tested:

  • Products tab scan button from ProductListViewModel changes for sites with and without Woo Square plugin
  • Orders with shipping labels from the legacy shipping plugin
  • Orders with subscription products from Woo Subscriptions plugin
  • Orders shipment tracking work as before

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@jaclync jaclync added the type: technical debt Represents or solves tech debt of the project. label Jul 22, 2025
@jaclync jaclync added this to the 22.9 milestone Jul 22, 2025
@jaclync jaclync changed the title Update WC plugin matching to use the file name in plugin path: use cases that match plugin by name Update WC plugin matching to use the file name in plugin path: use cases that match plugin by name - part 1 Jul 22, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 22, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15938-9289da7
Version22.8
Bundle IDcom.automattic.alpha.woocommerce
Commit9289da7
Installation URL2trunet4j6gf0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync requested a review from staskus July 22, 2025 20:51
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍 Tested installing the plugins in the enum and the check works correctly

import Foundation

public enum Plugin: Equatable, CaseIterable {
case wooCommerce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea to make an enum for consistency 👍

@jaclync jaclync merged commit 14536d1 into trunk Jul 23, 2025
13 checks passed
@jaclync jaclync deleted the backlog/WOOMOB-913-part-1-replace-plugin-matching-by-name branch July 23, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: technical debt Represents or solves tech debt of the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants